{% extends 'manage/base_manage.html' %}
{% load static %}
{% block title %}编辑单一接口用例{% endblock %}


{% block css %}
    <link rel="stylesheet" href="{% static 'css/apis/apis_update.css' %}">
{% endblock %}

{% block content %}
    <div class="content">
        <div id="test_content_apis">
            <h3 id="add_test_name">编辑接口用例</h3>
            <div id="title_apis">
                <form id="product_input" method="post" action="{% url 'atp:apis_update' apis.id %}">
                    {% csrf_token %}
                    <div class="form-group">
                        <label id='product_name_distance' for="p_name_input">产品：</label>
                        <br><br>
                        <select class="form-control" name="dropdown">
                            {% for pro_name in pro_names %}
                                {% if pro_name.id == apis.api_product_id %}
                                    <option value="{{ pro_name.id }}" selected>
                                        {{ pro_name.product_name }}
                                    </option>
                                {% else %}
                                    <option value="{{ pro_name.pk }}">
                                        {{ pro_name.product_name }}
                                    </option>
                                {% endif %}
                            {% endfor %}
                        </select>
                    </div>
                    <div class="form-group">
                        <label id='product_name_distance' for="p_des_input">接口用例名称：</label>
                        <br><br>
                        <input name="api_name" type="text" class="form-control" id="p_des_input"
                               placeholder="输入接口用例名称" value="{{ apis.api_name }}">
                        <p style="color: red">{{ msg_api_name }}</p>
                    </div>
                    <div class="form-group">
                        <label id='product_name_distance' for="p_er_input">Url地址：</label>
                        <br><br>
                        <input name="api_url" type="text" class="form-control" id="p_er_input" placeholder="输入Url地址"
                               value="{{ apis.api_url }}">
                    </div>
                    <div class="form-group">
                        <label id='product_name_distance' for="p_er_input">请求参数和值：</label>
                        <br><br>
                        <input name="api_param_value" type="text" class="form-control" id="p_er_input"
                               placeholder="输入请求参数和值" value="{{ apis.api_param_value }}">
                    </div>
                    <div class="form-group">
                        <label id='product_name_distance' for="p_er_input">请求方法：</label>
                        <br><br>
                        <select class="form-control" name="method_check">
                            {% if apis.api_method == "get" %}
                                <option value="get" selected>get</option>
                                <option value="post">post</option>
                            {% elif apis.api_method == "post" %}
                                <option value="get">get</option>
                                <option value="post" selected>post</option>
                            {% endif %}
                        </select>
                    </div>
                    <div class="form-group">
                        <label id='product_name_distance' for="p_er_input">预期结果：</label>
                        <br><br>
                        <input name="api_result" type="text" class="form-control" placeholder="输入预期结果"
                               value="{{ apis.api_result }}">
                    </div>
                    <div class="form-group">
                        <label id='product_name_distance' for="p_er_input">测试结果：</label>
                        <br><br>
                        <select class="form-control" name="api_status">
                            {% if apis.api_status == 1 %}
                                <option value="1" selected>True</option>
                                <option value="0">False</option>
                            {% elif apis.api_status == 0 %}
                                <option value="1">True</option>
                                <option value="0" selected>False</option>
                            {% endif %}
                        </select>
                    </div>
                    <button type="submit" class="btn">保存</button>
                </form>
            </div>
        </div>
    </div>
{% endblock %}